<?
	require_once('class.phpmailer.php');
	define('GUSER', 'bigbenvn@gmail.com');
	define('GPWD', 'thienmenh'); 
	
	function smtpmailer($to, $from, $from_name, $subject, $body) 
	{ 
		global $error;
		$mail = new PHPMailer();  
		
		$mail->IsSMTP();
		$mail->CharSet	  = "utf-8"; 
		$mail->Host       = "mail.gmail.com"; 
		$mail->SMTPDebug  = 0;                    
		$mail->SMTPAuth   = true;                  
		$mail->SMTPSecure = "ssl";                 
		$mail->Host       = "smtp.gmail.com";      
		$mail->Port       = 465;                   
		$mail->Username   = GUSER;
		$mail->Password   = GPWD;
		
		$mail->SetFrom($from, $from_name);
		$mail->Subject    = $subject;
		$mail->MsgHTML($body);
		

		$mail->AddAddress($to);
		
		
		if(!$mail->Send()) {
			$error = 'Gởi mail bị lỗi: '.$mail->ErrorInfo; 
			return false;
		} else {
			return true;
		}
	}  
?>